<!--地图组件-->
<template>
  <div id="baseMap"></div>
</template>

<script>
import { initMap } from "@/utils/map.js";
// 引入 echarts 核心模块，核心模块提供了 echarts 使用必须要的接口。
import * as echarts from 'echarts/core';
export default {
  mounted(){
    // 基于准备好的dom，初始化echarts实例
    this.$nextTick(()=>{
      this.$store.state.redBase.myChart = echarts.init(document.getElementById('baseMap'));
      this.$store.state.redBase.myChart.on('click', (params) => {
        this.$store.commit('redBase/setCmpName',params.name+'分公司');
        this.$store.dispatch('redBase/getRedRouteList',this.$store.state.redBase.routerId);
      });
      this.$store.state.redBase.myChart.setOption(initMap());
    })
  },
}
</script>
<style scoped lang="less">
@import "@/assets/css/redBase/redBase";
</style>
